package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.entity.Owner;
import com.woniu.communitymanagement.service.OwnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/owner")
@CrossOrigin(origins = "*")
public class OwnerController {
    @Autowired
    private OwnerService ownerService;
    @RequestMapping("/delete")
    public HttpResult deleteById(Integer id){
        return ownerService.deleteById(id);
    }
    @RequestMapping("/update")
    public HttpResult updateById(@RequestBody Owner owner){
        return ownerService.updateOwnerById(owner);
    }
    @RequestMapping("/insert")
    public HttpResult insertOwner(@RequestBody Owner owner){
        return ownerService.insertOwner(owner);
    }
    @RequestMapping("/list")
    public HttpResult List(String tel,String identity,Integer pageIndex,Integer pageSize){
        return ownerService.selectAll(tel,identity,pageIndex,pageSize);
    }
    @RequestMapping("/selectOne")
    public HttpResult selectOne(Integer id){
        return ownerService.selectOne(id);
    }
    @RequestMapping("/all")
    public HttpResult all(){
        return ownerService.all();
    }

}
